import http from '@/utils/http'

const BASE_URL = '/cakerun/storeCakePerformanceStatistics'
export interface StoreCakePerformanceStatisticssQuery {
  accountIds?: number[]
  startDate: string
  endDate: string
}
export interface StoreCakePerformanceStatisticsResp {
  storeCity: number
  poiName: string
  storeScore: string
  goodReviewCount: string
  badReviewCount: string
  orderCount: number
  orderRevenue: number
  cakeCount: number
  cakeRevenue: number
  merchantEarnings: number
}

export interface StoreCakePerformanceStatisticsReq {
  statisticsDate: string
  accountIds?: string[]
}

export function fetchStoreCakePerformanceStatistics(query: StoreCakePerformanceStatisticssQuery) {
  return http.get<StoreCakePerformanceStatisticsResp[]>(`${BASE_URL}`, query)
}

export function exportStoreCakePerformanceStatistics(query: StoreCakePerformanceStatisticssQuery) {
  return http.download(`${BASE_URL}/export`, query)
}
